<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.jqGrid.cz.audit"/></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
	<input type="hidden" id="typeflag" value='null'>
	<section class="content-header">
	<h1><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.jqGrid.cz.audit"/></h1>
	<ol class="breadcrumb">
		<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
        <li class="active"><a href="#"><spring:message code="message.jieSuan.jiaoKuanDanGuanLi"/></a></li>
        <li class="active"><a href="#"><spring:message code="message.listForm.yiLiaoJiGou"/><spring:message code="message.jieSuan.jiaoKuanDanGuanLi"/></a></li>
        <li class="active"><a href="#"><spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.jqGrid.cz.audit"/></a></li>
	</ol>
	</section>
	<section class="content">
	<div class=" box box-success">
		<div class="box-body">
			<form class=" form-inline" id='form'>
				<div class="input">
                <div class="textalign1"><spring:message code="message.jieSuan.jiaoKuanDanBianHao"/><spring:message code="message.yanZheng.maoHao"/></div>
               	   <div class="boxinput">
                   <input type="text" class="textinput" id="postOrderCode" name="postOrderCode" placeholder="<spring:message code="message.jieSuan.jiaoKuanDanBianHao"/>" />
			   	   </div>
			   	<div class="textalign"><spring:message code="message.jieSuan.jiaoKuanDate"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id=submitStartDatetime name="submitStartDatetime" type="text" class="textinput" placeholder="yyyy-MM-dd"
						data-date-fmt="yyyy-MM-dd" onFocus="var endDate=$dp.$('submitEndDatetime');WdatePicker({maxDate:'#F{$dp.$D(\'submitEndDatetime\')}'})" />
                                    </td> 
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id=submitEndDatetime name="submitEndDatetime" type="text" class="textinput"  placeholder="yyyy-MM-dd"
						data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'submitStartDatetime\')}'})" />
                                    </td>
                                </tr>
                            </table>
                    </div>
                    <div class="textalign" >
				<button type="button" class="btn btn-success btn-sm"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
			</div>
			</div>
			</form>
		</div>
	</div>
	<table class="jqgrid" id="gridlist"></table>
	<div id="gridpage"></div>
	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
	<script type="text/javascript">
	   //绑定回车
	   $('#postOrderCode,#submitStartDatetime,#submitEndDatetime').bind('keydown', function(event) {  
	       if (event.keyCode == "13") {
	           $('#selectDicCompType').click();
	       }
	   });	
	   $("#postOrderCode").focus();//加载页面光标在第一个查询框内
	
	
		$(function() {
	 	var date =  new Date();
		var nowDate = date.format("yyyy-MM-dd");
		var lastDate = new Date;
		lastDate.setMonth(lastDate.getMonth() - 1);
		lastDate = lastDate.format("yyyy-MM-dd");
		$('#submitStartDatetime').val(lastDate);
		$('#submitEndDatetime').val(nowDate);
		 
		  $("#orderStatus").HNSelect({
   	        url: "getAuditPostOrderListBySetCenter.html",
   	        data: { classifyCode: '119' },
   	        defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
   	    });
			$("#gridlist").jqGrid(
					{   url : "getAuditPostOrderListBySetCenter.html",
						mtype : "POST",
						datatype : "json",
						autowidth : true,
						shrinkToFit : true,
						height : 233,
						colNames : [
									'<spring:message code="message.jqGrid.cz"/>',
						            '<spring:message code="message.jieSuan.jiaoKuanDanBianHao"/>',
						            '<spring:message code="message.jieSuan.jiaoKuanDanMingCheng"/>',
						            '<spring:message code="message.jieSuan.jiaoKuanJiGou"/>',
						            '<spring:message code="message.jieSuan.shouKuanJiGou"/>',
						            '<spring:message code="message.jieSuan.jiaoKuanJinE"/>',
						            '<spring:message code="message.jieSuan.jiaoKuanTime"/>',
						            
						            ],
						colModel : [
						            
									{name : 'operate', width : 100, align : 'center', sortable : false,
										formatter : function(val, opts, rowdata) {
										var str = "";
										str += "<a href='${ctx}/postOrder/toAuditPostOrderBySetCenter.html?postOrderId="+rowdata.postOrderId+"'><spring:message code="message.jqGrid.cz.audit"/></a>";
										return str;
									}}, 
									{name : 'postOrderCode',index : 'postOrderCode',width : 195, sortable: false, align : "center"},
									{name : 'postOrderName',index : 'postOrderName',width : 207, sortable: false, align : "center"},
									{name : 'postName',index : 'joinPlanTime',width : 166, sortable: false, align : "center"},
									{name : 'recpName',index : 'proPrice',width : 80, sortable: false, align : "center"},
									{name : 'postAmount',index : 'proPrice',width : 80, sortable: false, align : "right",
										formatter :function(val){
											return val.toFixed(2);
										}
									},
									{name : 'createDatetime',index : 'proPrice',width : 140, sortable: false, align : "center",}
									
						],
						rowNum : 20,
						rowList : [ 10, 20,50,100],
						rownumbers : true,
						pager : "#gridpage",
						//multiselect: true, 
						viewrecords : true,
						gridComplete: function(){
		    	        	 //序号列宽度自适应（参数为jqgridID）
		    	               autoRNWidth("gridlist");
		    	           	//数据只有一条时默认选中（参数为jqgridID）
		    	               selectByOneData("gridlist");
		    			},
						caption : "<spring:message code="message.jieSuan.jiaoKuanDan"/><spring:message code="message.listForm.lieBiao"/>",
						jsonReader : {
							repeatitems : false,
							id : "ids"
						}
					});

			$("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
			$(window).trigger("resize");
			
			   /*按条件查询*/
			   $('.btn-success').click(function(){
					   var postJson = formatForm("form");
					   var strat = new Date( postJson['submitStartDatetime'].replace(/-/g,"/") );
					   var End = new Date( postJson['submitEndDatetime'].replace(/-/g,"/") );
					  //起始日期大于截至日期的判断
					   if (strat > End) {
						 var temp =postJson['submitStartDatetime'];
						 postJson['submitStartDatetime'] = postJson['submitEndDatetime'];
						 postJson['submitEndDatetime']= temp;
						 $("[name='submitStartDatetime']").val($("[name='submitEndDatetime']").val());
						 $("[name='submitEndDatetime']").val(temp);
						 temp=null;
					   }
			                $("#gridlist").jqGrid("clearGridData");
			                $("#gridlist").jqGrid('setGridParam',{  
			                mtype: "POST",
			                datatype:'json',
			                postData:postJson,
			                page : 1
			            }).trigger("reloadGrid"); 
			   });
		});
	</script>
</body>
</html>